import wx
import traceback

def popuperror(func):
    def myfunc(*args, **kwargs):
        try:
            return func(*args, **kwargs)
        except AssertionError as e:
            wx.LogError(str(e))
        except:
            wx.LogError(traceback.format_exc())

    return myfunc